If you have the auto-installable version, you can happily skip this section. There are no special instructions and everything is automatic. The system installs in the ‘Programs’ menu item of the ‘Start menu’ of windows.
Depending how did you obtain the software, you can start either with a zip file, or with a CDROM. In both cases, you should execute in this order:
lccwin32.exe. This installs the compiler and the basic system.
lcc2.exe. This installs the examples and the source code.
lcc3.exe. This installs the sources for the debugger/linker/IDE, etc.
lccdoc.exe. This installs the documentation.
fortran.exe. This installs the Fortran compiler.
w32hlp.exe. This installs the windows on-line docs.
lccdb.exe. This installs the database module.
You should establish a directory tree like this:
lcc |
|
|
Root directory |
|
bin |
|
Binaries |
|
include |
|
Include headers. |
|
|
gl |
Open gl headers |
|
|
sys |
System specific headers |
|
lib |
|
Libraries |
|
|
wizard |
Wizard templates |
|
buildlib |
|
EXP files for the buildlib utility |
|
src |
|
Sources root dir |
|
|
lccsrc |
Compiler sources. Optional. |
|
|
pedump |
Sources of the pedump utility |
|
examples |
|
Samples |
In the \lcc\bin directory you should have the executables for (at least):
·Wedit.exe The IDE
·lcc.exe The compiler
·lcclnk.exe The linker
·lcclib.exe The librarian
·buildlib.exe Utility for building import libraries
·Weditres.exe Resource editor
·lrc.exe Resource
compiler
·make.exe The program maintenance utility
·dolibs.exe Automatic
construction of the libraries.
In the \lcc\include directory you should have all the include files distributed with lcc-win32: windows.h, stdio.h etc.
In the \lcc\lib directory you should have the libraries, and the startup code. The startup code comes in two varieties:
1.lcccrt0.obj, for normal programs
2.libcrt0.obj, for DLLs
In the lib directory there is a sub-directory ‘wizard’ that contains the templates that the wizard utility uses for automatically generating Windows programs. The templates have an extension of .tpl.
The lcc-win32 system supposes this directory structure. You have to establish a directory tree like this. You can add/delete directories, but at least those mentioned above should be present. The installation program will automatically do this.
Once this step is finished you are done. Lcc-win32 is ready to run. Start Wedit, and make a project for the ‘hello’ sample in the \lcc\demo\hello directory. If everything is correct, you should be able to compile that short program.
After the copying of the system files is finished, the lcc setup program will call the ‘dolibs.exe’ utility to build all the import libraries from their ASCII descriptions. This saves download time, since the megabytes of import libraries are not transmitted but generated at your machine.
Sometimes for various reasons[1], the dolibs.exe utility does not work properly. In this case you can do the work manually. Do the following:
cd \lcc\buildlib this supposes you installed
in \lcc
make start building the libraries
copy *.lib \lcc\lib copy libraries to \lcc\lib directory
del *.lib erase all libs from the buildlib directory
The buildlib utility is called with each ASCII description of the import library, building the import lib. The newly created libraries should be moved to \lcc\lib so that the linker finds them when it needs them.
The registry keys that lcc-win32 uses are stored under the key HKEY_CURRENT_USER, i.e.; if you log in under another user ID after installing lcc-win32, you will be forced to install it again. If you install under the same directory, everything will work properly.
The lcc-win32 system assumes the software is under a directory called ‘lcc’. Please do not change this name.
Another possible problem are paths with spaces in them, for instance “Program Files”. I have tried to do my best to account for this, and the latest versions of the software should handle those paths without problems, I have installed my own copy of lcc in Program Files, but ther could be still some problems in the utilities like lcclnk or lcclib. If you find path related problems, re-instal lcc in a directory without spaces in it.
The configuration of the compiler is done through Project à Configuration menu option.
· Preprocessor defines. Write here the –D directives without any options. If you want to #define MYDEF you would write: MYDEF in the edit field. If you have several of those write: MYDEF, MY_OTHER_DEF. This will provoke that the development environment will call the compiler with –DMYDEF and –DMY_OTHER_DEF as command line arguments.
· Include Path. Here you write several paths separated by spaces. It is imperative to put double quotes in path names that have spaces, as shown in the example above. This will be translated by the development environment as: -I"c:\program files\lcc\include". This is just an example. It is NOT necessary to put there the path of the standard includes.
· Generate Asm. This will produce an assembly listing that will have the same name as the source file but an .asm extension.
· Optimize. The compiler will try to generate the best code.
· Generate browse info. Normally the IDE does this automatically, so this is not really necessary.
· Use Pentium pro instructions. If you choose this (command line option –p6) the new p6 instructions will be used and your code will NOT run in a previous processor.
· Structure alignment. This sets the space that the compiler will use to align structures.
· Debugging support level. This can be the strict minimum (Generate debug info) or more sophisticated error reports in case of crash (Run time stack trace support) that can have even line number display.
· Language extensions. Whether to use the lcc-win32 language extensions (operator overloading, etc). Leave this as above.
· Warning level: Self evident.
· Generate intermediate language file. A .LIL (Lcc Intermediate Language) file is generated. This helps understand how the compiler works.
· Output file name. This defaults to a file under the sources directory where the binary files are stored. You can put another path if you wish that the linker output goes somewhere else
· Additional libraries. Here you put a series of libraries you may need separated by spaces.
· Generate a map file. A file containing the address of each procedure will be generated and helps you out to decipher cryptic addresses when a trap occurs.
· Do not include underscores in dll exports. This is useful for DLLs that will be used by VB.
· Type of output. It can be one of: "windows appl", I.e. a windows program, a "console" application that runs under a shell window, a DLL or a static library.
· Additional arguments. Here you should add the .def file if you are building a DLL.
To start using lcc-win32, a
simple application will be used as an example. Start the editor (Wedit), go to
the Project menu, and choose Create. You will be prompted for the name of the
new project. Enter a short name, without spaces in it.[2]
The project definition
dialog box appears. You should specify a source directory, where your project
will be built. If that directory does not exist, it will be created. Choose a
Windows application as the type of application, and press the Create button.
You will be prompted if
the wizard should write the project skeleton for you. You should answer: Yes.
Wedit minimizes itself, and the wizard definition dialog box appears. You can
select several types of applications, but to get started easily, maintains all
of the default settings, and press Continue until the wizard informs you that
the files have been created. Wedit will restart, and it will make a ‘Makefile’
from the files generated.
When the ‘Makefile’ has been created, press the F9 key to compile your application. This should go very quickly since the application is very small. Then press Ctrl+F5 to start your new application. A window will appear with the name of the application in the title bar.
You can debug your application by using the F5 key — Wedit’s debugger. Press F4 to go line by line to execute the application. The F8 key is used for stepping into procedure calls. The F4 key skips procedure calls and always stays at the same level.
You can modify the dialog boxes or other types of resources using the integrated resource editor. Go to the Resources menu, and choose Open. This will open the resource editor in which you can add new dialog box definitions, menus, resource strings, or other types of resources to your application.
To define a dialog box, choose Resources, then New, then dialog box. An empty dialog box will be created, and the resource editor will automatically bring up the properties of the dialog box. You can then change the title, style, etc.
To populate your dialog box with controls, just select a control type in the floating toolbar of Wedit, drag and drop it in the desired position. You can test your dialog box by using the Test option in the Resources menu at any time. You can change the properties of any control by double-clicking on the specified control. This also applies to the dialog box as a whole.
By pressing the right mouse button anywhere within the program text, you
can always go to the definition of a symbol, or add special comments to your
code. A quicker way to navigate through your code is to use the F12 key to show
the list of defined functions in the current file. The keys Ctrl+F8 will show
you where the symbol under the cursor is used.
Wedit has many settings for fonts, compiler configuration, links, etc. All of them are in the Project menu, under Configuration.
If you do not want to create a project, you can load any C source file, and press Compile. Wedit will create a default project for the Windows application if it finds a WinMain procedure or Console application if it finds a main() function. In this case, you should have a file that needs no other source files. You can create a project easily within a few seconds.
[1] In some systems, there is an old command.com
present that gets called instead of the correct win32 command interpreter. In
this case, a DOS session is opened and other things fail completely. The
command can fail for lack of disk space, or other reasons.
[2] This name will be added under the
\HKEY_CURRENT_USER\Software\lcc\Wedit. See the ‘Projects’ chapter in this
manual for greater detail.